import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import "normalize.css";
import "./styles/index.scss"
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.use(ElementUI);

Vue.mixin({ //类似于全局属性
  data() {
    return {
      /**
       * 数据列表
       */
      list: [],
      /**
       * 查询loading
       */
      queryLoading:false,
    }
  },
})

Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

/**
 * 时间格式化
 */
 Date.prototype.format = function (fmt = 'yyyy-MM-dd HH:mm:ss') {
  /**
   * 日期数据
   */
  const opts = {
    'y+': this.getFullYear().toString(),
    'M+': (this.getMonth() + 1).toString(),
    'd+': this.getDate().toString(),
    'H+': this.getHours().toString(),
    'm+': this.getMinutes().toString(),
    's+': this.getSeconds().toString(),
    'f+': this.getMilliseconds().toString()
  }
  for (const key in opts) {
    const value = opts[key];  //时间值
    if (new RegExp(`(${key})`).test(fmt)) {
      const result = RegExp.$1; //如果匹配成功则可以获取到结果
      fmt = fmt.replace(result, value.padStart(result.length, '0'));
    }
  }
  return fmt;
} 

